macro "TUJ1 area counting + Dapi + EdU + p75" {

path    = getDirectory("Choose a Directory");
list    = getFileList(path);
length  = list.length;
File.makeDirectory(path + "Imaging/");

for (i=0; i<length; i++) {
	       n=i+1;
               open(path+list[i]);
               temp = File.name();
                                            
 //measure area of TUJ1
 			   run("Split Channels");
		       setAutoThreshold("Otsu dark");
			   //setThreshold(23, 255);
			   waitForUser("adjust area TUJ1 total");
			   run("Create Selection");
			   run("Measure");
			   
//ROI of dapi			   
			   waitForUser("select dapi");
			   setAutoThreshold("Default dark");
			   waitForUser("ajustar dapi");
			   run("Create Selection");			   
			   run("Enlarge...", "enlarge=2");
			   roiManager("Add");

//delete the soma from TUJ1 channel using dapi mask			   
			   waitForUser("select green");
			   waitForUser("select the ROI");
			   setBackgroundColor(0, 0, 0);
			   run("Clear", "slice");

//Measure the area occupied by TUJ1 (would be only in te proces)  
			   waitForUser("click out of selection");
			   run("Create Selection");
			   run("Measure");
			   
//Measure the area of p75               
			   waitForUser("Select p75 image");
			   setAutoThreshold("Otsu dark");
			   waitForUser("adjust p75 area");
			   run("Create Selection");
			   run("Measure");
			   waitForUser("copy p75 to excel");
			   
//Counting EdU
			   waitForUser("Select EdU image");
			   setAutoThreshold("Intermodes dark");
			   waitForUser("adjust EdU selection");
			   run("Convert to Mask");
			   run("Fill Holes");
			   run("Watershed");
			   run("Analyze Particles...", "size=15-130 circularity=0.50-1.00 show=[Overlay Masks] display clear in_situ");
			   waitForUser("copy EdU # to excel");

//Count dapi			 	
			   waitForUser("select dapi");
			   setAutoThreshold("Minimum dark");
			   waitForUser("adjust Dapi selection");
			   run("Convert to Mask");
			   run("Fill Holes");
			   run("Watershed");
			   run("Analyze Particles...", "size=10-130 circularity=0.50-1.00 show=[Overlay Masks] display clear in_situ");
			   waitForUser("copy dapi to excel");
             
               run("Close All");}

}
